--- locallib.php 2013-11-16 20:16:11.000000000 +1100 +++ locallib_update.php 2013-11-16 20:49:44.000000000 +1100 @@ -25,6 +25,9 @@ require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/lib.php'); +global $PAGE; +$PAGE->requires->js('/mod/checklist/checklist.js'); + define("CHECKLIST_TEXT_INPUT_WIDTH", 45); define("CHECKLIST_OPTIONAL_NO", 0); define("CHECKLIST_OPTIONAL_YES", 1); @@ -1816,6 +1819,31 @@ class checklist_class { } } } + + + function add_row ($table) { + $passed_row = $table->data; + $ret_output = ''; + $ret_output .= ''; + foreach ($passed_row[0] as $key => $item) { + if ($key == 0) { + $ret_output .= ' '; + } else { + $size = $table->size[$key]; + $img = ' '; + $cellclass = 'cell c'.$key.' level'.$table->level[$key]; + list($teachermark, $studentmark, $heading, $userid, $checkid) = $item; + if ($heading) { + $ret_output .= ' '; + } else { + $ret_output .= ''; + } + } + } + $ret_output .= ''; + return $ret_output; + } + function print_report_table($table, $editchecks) { global $OUTPUT; @@ -1830,14 +1858,22 @@ class checklist_class { $teachermarklocked = $this->checklist->lockteachermarks && !has_capability('mod/checklist:updatelocked', $this->context); // Sort out the heading row + $countcols = count($table->head); $output .= ''; $keys = array_keys($table->head); $lastkey = end($keys); + $colspan_bool = true; foreach ($table->head as $key => $heading) { if ($table->skip[$key]) { continue; } $size = $table->size[$key]; + if ($colspan_bool && $editchecks) { + $colspan = "2"; + $colspan_bool = false; + } else { + $colspan = "1"; + } $levelclass = ' head'.$table->level[$key]; if ($key == $lastkey) { $levelclass .= ' lastcol'; @@ -1846,7 +1882,7 @@ class checklist_class { $output .= $heading.''; } $output .= ''; - + if ($editchecks) $output .= $this->add_row($table); // Output the data $tickimg = ''.get_string('itemcomplete','checklist').''; $teacherimg = array(CHECKLIST_TEACHERMARK_UNDECIDED => ''.get_string('teachermarkundecided','checklist').'', @@ -1865,18 +1901,28 @@ class checklist_class { $output .= ''; $keys2 = array_keys($row); $lastkey = end($keys2); + $bool = true; foreach ($row as $colkey => $item) { if ($table->skip[$colkey]) { continue; } if ($colkey == 0) { // First item is the name + $esc_link = htmlentities($item); + $esc_link_id = strpos($esc_link, '?id='); + $esc_link_2 = substr($esc_link, $esc_link_id + 4); + $esc_link_and = strpos($esc_link_2, '&'); + $uid = substr($esc_link_2, 0, $esc_link_and); $output .= ''.$item.''; } else { $size = $table->size[$colkey]; $img = ' '; $cellclass = 'level'.$table->level[$colkey]; list($teachermark, $studentmark, $heading, $userid, $checkid) = $item; + if ($bool && $editchecks) { + $output .= ''; + $bool = false; + } if ($heading) { $output .= ' '; } else {